package com.pand.model.order;

import com.pand.model.BaseObject;

import javax.persistence.*;
import java.util.Date;

/**
 * 
 * @ClassName: Order
 * @Description: 订单
 *
 */
@Entity
@Table(name = "BIZ_ORDER")
@SequenceGenerator(name = "SeqOrder", sequenceName = "SEQ_ORDER", allocationSize = 1)
public class Order extends BaseObject {
	/**
	 * @Fields serialVersionUID :添加类成员变量的功能描述
	 */
	private static final long serialVersionUID = 1L;

	/**
	 * 主键
	 */
	private Long id;

	/**
	 * 订单号
	 */
	private String orderNo;

	/**
	 * 客户ID
	 */
	private Long customerId;

	/**
	 * 客户类型
	 */
	private Integer customerType;

	/**
	 * 客户名称
	 */
	private String customerName;

	/**
	 * 联系人姓名
	 */
	private String contactorName;

	/**
	 * 联系人电话
	 */
	private String contactorPhone;

	/**
	 * 租车类型
	 */
	private String rentalType;

	/**
	 * 支付状态
	 */
	private String payStatus;

	/**
	 * 租车计数
	 */
	private Integer rentalCount;

	/**
	 * 创建时间
	 */
	private Date createTime;

	/**
	 * 
	 */
	private Date modTime;

	/**
	 * 订单状态
	 */
	private String orderStatus;

	/**
	 * 
	 */
	private Integer orderSrc;

	/**
	 * 
	 */
	private String operator;

	/**
	 * 备注
	 */
	private String remark;

	/**
	 *
	 */
	private String contractURL;

	/**
	 * 是否需要发票
	 */
	private Boolean needInvoice;

	/**
	 * 发票ID
	 */
	private Long invoiceId;

	/**
	 * 订单总金额
	 */
	private Double totalAmount;

	/**
	 * 减免总金额
	 */
	private Double totalReduceAmount;

	/**
	 * 已付款金额
	 */
	private Double payedAmount;

	/**
	 * 欠款金额
	 */
	private Double owedAmount;

	/**
	 * 合同附件
	 */
	private String contractAttatch;

	/**
	 * 预付款分类
	 */
	private String prepayCategory;

	/**
	 * 是否有违章记录，默认为有违章记录
	 */
	private Boolean isInfringe = true;

	/**
	 * 审核通过1，不通过0
	 */
	private Integer retCarAuditPass = 0;

	/**
	 * 交易时间
	 */
	private Date tradeTime;

	/**
	 * 审核不通过原因
	 */
	private String retcarauditDescription;

	/**
	 * 通知超间
	 */
	private Boolean notifyTimeout = false;

	/**
	 * 支付类型
	 */
	private String payType;

	/**
	 * 支付类型名称
	 */
	private String payTypeName;

	/**
	 * 坏车类型1.正常还车、2.离线还车
	 */
	private Integer orderRetType;

	/**
	 * 城市编码
	 */
	private String cityCode;

	/**
	 * 里程计费
	 */
	private Double mileageAmount;

	/**
	 * 时间计费
	 */
	private Double timeAmount;

	/**
	 * 还车时间 和 GPS上报时间的时间差,单位秒。
	 */
	private Long retVehGPSTime;

	@Column(name = "RETCARAUDITDESCRIPTION")
	public String getRetcarauditDescription() {
		return retcarauditDescription;
	}

	public void setRetcarauditDescription(String retcarauditDescription) {
		this.retcarauditDescription = retcarauditDescription;
	}

	@Id
	@GeneratedValue(generator = "SeqOrder")
	@Column(name = "ID")
	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	@Column(name = "ORDER_NO")
	public String getOrderNo() {
		return orderNo;
	}

	public void setOrderNo(String orderNo) {
		this.orderNo = orderNo;
	}

	@Column(name = "CUSTOMER_ID")
	public Long getCustomerId() {
		return customerId;
	}

	public void setCustomerId(Long customerId) {
		this.customerId = customerId;
	}

	@Column(name = "CUSTOMER_TYPE")
	public Integer getCustomerType() {
		return customerType;
	}

	public void setCustomerType(Integer customerType) {
		this.customerType = customerType;
	}

	@Column(name = "CUSTOMER_NAME")
	public String getCustomerName() {
		return customerName;
	}

	public void setCustomerName(String customerName) {
		this.customerName = customerName;
	}

	@Column(name = "CONTACTOR_NAME")
	public String getContactorName() {
		return contactorName;
	}

	public void setContactorName(String contactorName) {
		this.contactorName = contactorName;
	}

	@Column(name = "CONTACTOR_PHONE")
	public String getContactorPhone() {
		return contactorPhone;
	}

	public void setContactorPhone(String contactorPhone) {
		this.contactorPhone = contactorPhone;
	}

	@Column(name = "RENTAL_COUNT")
	public Integer getRentalCount() {
		return rentalCount;
	}

	public void setRentalCount(Integer rentalCount) {
		this.rentalCount = rentalCount;
	}

	@Column(name = "CREATE_TIME")
	public Date getCreateTime() {
		return createTime;
	}

	public void setCreateTime(Date createTime) {
		this.createTime = createTime;
	}

	@Column(name = "MOD_TIME")
	public Date getModTime() {
		return modTime;
	}

	public void setModTime(Date modTime) {
		this.modTime = modTime;
	}

	@Column(name = "ORDER_STATUS")
	public String getOrderStatus() {
		return orderStatus;
	}

	public void setOrderStatus(String orderStatus) {
		this.orderStatus = orderStatus;
	}

	@Column(name = "ORDER_SRC")
	public Integer getOrderSrc() {
		return orderSrc;
	}

	public void setOrderSrc(Integer orderSrc) {
		this.orderSrc = orderSrc;
	}

	@Column(name = "OPERATOR")
	public String getOperator() {
		return operator;
	}

	public void setOperator(String operator) {
		this.operator = operator;
	}

	@Column(name = "REMARK")
	public String getRemark() {
		return remark;
	}

	public void setRemark(String remark) {
		this.remark = remark;
	}

	@Column(name = "CONTRACT_URL")
	public String getContractURL() {
		return contractURL;
	}

	public void setContractURL(String contractURL) {
		this.contractURL = contractURL;
	}

	@Column(name = "NEED_INVOICE")
	public Boolean getNeedInvoice() {
		return needInvoice;
	}

	public void setNeedInvoice(Boolean needInvoice) {
		this.needInvoice = needInvoice;
	}

	@Column(name = "INVOICE_ID")
	public Long getInvoiceId() {
		return invoiceId;
	}

	public void setInvoiceId(Long invoiceId) {
		this.invoiceId = invoiceId;
	}

	@Column(name = "RENTAL_TYPE")
	public String getRentalType() {
		return rentalType;
	}

	public void setRentalType(String rentalType) {
		this.rentalType = rentalType;
	}

	@Column(name = "PAY_STATUS")
	public String getPayStatus() {
		return payStatus;
	}

	public void setPayStatus(String payStatus) {
		this.payStatus = payStatus;
	}

	@Column(name = "TOTAL_AMOUNT")
	public Double getTotalAmount() {
		return totalAmount == null ? 0 : totalAmount;
	}

	public void setTotalAmount(Double totalAmount) {
		this.totalAmount = totalAmount;
	}

	@Column(name = "TOTAL_REDUCE_AMOUNT")
	public Double getTotalReduceAmount() {
		return totalReduceAmount;
	}

	public void setTotalReduceAmount(Double totalReduceAmount) {
		this.totalReduceAmount = totalReduceAmount;
	}

	@Column(name = "PAYED_AMOUNT")
	public Double getPayedAmount() {
		return payedAmount;
	}

	public void setPayedAmount(Double payedAmount) {
		this.payedAmount = payedAmount;
	}

	@Column(name = "OWED_AMOUNT")
	public Double getOwedAmount() {
		return owedAmount;
	}

	public void setOwedAmount(Double owedAmount) {
		this.owedAmount = owedAmount;
	}

	@Column(name = "CONTRACT_ATTATCH")
	public String getContractAttatch() {
		return contractAttatch;
	}

	public void setContractAttatch(String contractAttatch) {
		this.contractAttatch = contractAttatch;
	}

	@Column(name = "PERPAY_CATEGORY")
	public String getPrepayCategory() {
		return prepayCategory;
	}

	public void setPrepayCategory(String prepayCategory) {
		this.prepayCategory = prepayCategory;
	}

	@Column(name = "IS_INFRINGE")
	public Boolean getIsInfringe() {
		return isInfringe;
	}

	public void setIsInfringe(Boolean isInfringe) {
		this.isInfringe = isInfringe;
	}

	@Column(name = "RETCARAUDITPASS")
	public Integer getRetCarAuditPass() {
		return retCarAuditPass;
	}

	public void setRetCarAuditPass(Integer retCarAuditPass) throws Exception {
		if (retCarAuditPass != null) {
			if (retCarAuditPass != 0 && retCarAuditPass != 1) {
				throw new Exception("还车审核订单审核是否通过字段只能为0或1");
			}
		}
		this.retCarAuditPass = retCarAuditPass;
	}

	@Column(name = "TRADETIME")
	public Date getTradeTime() {
		return tradeTime;
	}

	public void setTradeTime(Date tradeTime) {
		this.tradeTime = tradeTime;
	}

	@Column(name = "NOTIFYTIMEOUT")
	public Boolean getNotifyTimeout() {
		return notifyTimeout;
	}

	public void setNotifyTimeout(Boolean notifyTimeout) {
		this.notifyTimeout = notifyTimeout;
	}

	@Column(name = "PAY_TYPE")
	public String getPayType() {
		return payType;
	}

	public void setPayType(String payType) {
		this.payType = payType;
	}

	@Column(name = "ORDER_RET_TYPE")
	public Integer getOrderRetType() {
		return orderRetType;
	}

	public void setOrderRetType(Integer orderRetType) {
		this.orderRetType = orderRetType;
	}

	@Column(name = "CITY_CODE")
	public String getCityCode() {
		return cityCode;
	}

	public void setCityCode(String cityCode) {
		this.cityCode = cityCode;
	}

	@Transient
	public String getPayTypeName() {
		return payTypeName;
	}

	public void setPayTypeName(String payTypeName) {
		this.payTypeName = payTypeName;
	}

	@Column(name = "MILEAGE_AMOUNT")
	public Double getMileageAmount() {
		return mileageAmount == null ? 0 : mileageAmount;
	}

	public void setMileageAmount(Double mileageAmount) {
		this.mileageAmount = mileageAmount;
	}

	@Column(name = "TIME_AMOUNT")
	public Double getTimeAmount() {
		return timeAmount == null ? 0 : timeAmount;

	}

	public void setTimeAmount(Double timeAmount) {
		this.timeAmount = timeAmount;
	}

	@Column(name = "ret_VehGPS_Time")
	public Long getRetVehGPSTime() {
		return retVehGPSTime;
	}

	public void setRetVehGPSTime(Long retVehGPSTime) {
		this.retVehGPSTime = retVehGPSTime;
	}

}
